<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProjectCommentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('project_comments', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('project_id')->comment('项ID');
            $table->unsignedBigInteger('row_id')->default(0)->comment('行ID');
            $table->unsignedBigInteger('user_id')->comment('评论人');
            $table->unsignedBigInteger('parent_id')->default(0)->comment('父级评论');
            $table->string('parents', 1000)->default('')->comment('父级集合');
            $table->text('content')->nullable()->comment('评论信息');
            $table->timestamps();

            $table->index('project_id');
            $table->index('row_id');
            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('project_comments');
    }
}
